test "string_to_int" {
  let result = Convert::string_to_int("123".to_string());
  assert_eq(result, Some(123));

  inspect(Convert::string_to_int("12.34"), content="None")
}

test "string_to_double" {
  let result = Convert::string_to_double("123.456".to_string())
  assert_eq(result, Some(123.456))

  let result = Convert::string_to_double("42".to_string())
  assert_eq(result, Some(42.0))

  inspect(Convert::string_to_double("42"), content="Some(42)")
}

test "string_to_double_enhanced - 整数" {
  inspect(Convert::string_to_double("123"), content="Some(123)")
  inspect(Convert::string_to_double("-456"), content="Some(-456)")
  inspect(Convert::string_to_double("+789"), content="Some(789)")
  inspect(Convert::string_to_double("0"), content="Some(0)")
}
test "string_to_double_enhanced - 小数" {
  inspect(Convert::string_to_double("123.45"), content="Some(123.45)")
  inspect(Convert::string_to_double("-67.89"), content="Some(-67.89)")
  inspect(Convert::string_to_double("0.123"), content="Some(0.12300000000000001)")
  inspect(Convert::string_to_double(".5"), content="Some(0.5)")
  inspect(Convert::string_to_double("42."), content="Some(42)")
}
test "string_to_double_enhanced - 科学计数法" {
  inspect(Convert::string_to_double("1.23e4"), content="Some(12300)")
  inspect(Convert::string_to_double("1.23E4"), content="Some(12300)")
  inspect(Convert::string_to_double("-2.5e-3"), content="Some(-0.0025)")
  inspect(Convert::string_to_double("6.022e23"), content="Some(6.021999999999999e+23)")
  inspect(Convert::string_to_double("1e10"), content="Some(10000000000)")
  inspect(Convert::string_to_double("3.14e0"), content="Some(3.14)")
  inspect(Convert::string_to_double("1.5e+2"), content="Some(150)")
}
test "string_to_double_enhanced - 空白字符处理" {
  inspect(Convert::string_to_double("  123.45  "), content="Some(123.45)")
  inspect(Convert::string_to_double("\t-67.89\n"), content="Some(-67.89)")
  inspect(Convert::string_to_double("\r1.23e4\r"), content="Some(12300)")
}
test "string_to_double_enhanced - 边界情况和错误" {
  inspect(Convert::string_to_double(""), content="None")
  inspect(Convert::string_to_double("   "), content="None")
  inspect(Convert::string_to_double("abc"), content="None")
  inspect(Convert::string_to_double("123abc"), content="None")
  inspect(Convert::string_to_double("12.34.56"), content="None")
  inspect(Convert::string_to_double("1.23ee4"), content="None")
  inspect(Convert::string_to_double("1.23e"), content="None")
  inspect(Convert::string_to_double("e123"), content="None")
  inspect(Convert::string_to_double("."), content="None")
  inspect(Convert::string_to_double("+-123"), content="None")
  inspect(Convert::string_to_double("1.23e+"), content="None")
  inspect(Convert::string_to_double("1.23e-"), content="None")
}



test "string_to_bool" {
  let result = Convert::string_to_bool("true".to_string());
  assert_eq(result, Some(true));
}

test "string_to_bool_false" {
  let result = Convert::string_to_bool("false".to_string());
  assert_eq(result, Some(false));
}

// 基本类型转字符串测试
test "int_to_string" {
  inspect(Convert::int_to_string(123), content="123")
  inspect(Convert::int_to_string(-456), content="-456")
  inspect(Convert::int_to_string(0), content="0")
}

test "double_to_string" {
  inspect(Convert::double_to_string(123.45), content="123.45")
  inspect(Convert::double_to_string(-67.89), content="-67.89")
  inspect(Convert::double_to_string(0.0), content="0")
}

test "bool_to_string" {
  inspect(Convert::bool_to_string(true), content="true")
  inspect(Convert::bool_to_string(false), content="false")
}

// 数值类型转换测试
test "int_to_double" {
  inspect(Convert::int_to_double(123), content="123")
  inspect(Convert::int_to_double(-456), content="-456")
  inspect(Convert::int_to_double(0), content="0")
}

test "double_to_int" {
  inspect(Convert::double_to_int(123.45), content="123")
  inspect(Convert::double_to_int(-67.89), content="-67")
  inspect(Convert::double_to_int(0.99), content="0")
}

test "double_to_int_round" {
  inspect(Convert::double_to_int_round(123.45), content="123")
  inspect(Convert::double_to_int_round(123.5), content="124")
  inspect(Convert::double_to_int_round(-67.5), content="-68")
  inspect(Convert::double_to_int_round(0.4), content="0")
  inspect(Convert::double_to_int_round(0.6), content="1")
}

// 字符转换测试
test "char_to_int" {
  inspect(Convert::char_to_int('A'), content="65")
  inspect(Convert::char_to_int('0'), content="48")
  inspect(Convert::char_to_int(' '), content="32")
}

test "int_to_char" {
  inspect(Convert::int_to_char(65), content="Some('A')")
  inspect(Convert::int_to_char(48), content="Some('0')")
  inspect(Convert::int_to_char(32), content="Some(' ')")
  inspect(Convert::int_to_char(128), content="None")
  inspect(Convert::int_to_char(-1), content="None")
}

// 字符串和字符数组转换测试
test "string_to_chars" {
  let chars = Convert::string_to_chars("Hello")
  inspect(chars.length(), content="5")
  inspect(chars[0], content="H")
  inspect(chars[4], content="o")
}

test "chars_to_string" {
  let chars = ['H', 'e', 'l', 'l', 'o']
  inspect(Convert::chars_to_string(chars), content="Hello")
}

// 十六进制转换测试
test "int_to_hex" {
  inspect(Convert::int_to_hex(255), content="FF")
  inspect(Convert::int_to_hex(16), content="10")
  inspect(Convert::int_to_hex(0), content="0")
  inspect(Convert::int_to_hex(-255), content="-FF")
}

test "hex_to_int" {
  inspect(Convert::hex_to_int("FF"), content="Some(255)")
  inspect(Convert::hex_to_int("0xFF"), content="Some(255)")
  inspect(Convert::hex_to_int("10"), content="Some(16)")
  inspect(Convert::hex_to_int("-FF"), content="Some(-255)")
  inspect(Convert::hex_to_int("0"), content="Some(0)")
  inspect(Convert::hex_to_int("abc"), content="Some(2748)")
  inspect(Convert::hex_to_int("XYZ"), content="None")
  inspect(Convert::hex_to_int(""), content="None")
}

// 二进制转换测试
test "int_to_binary" {
  inspect(Convert::int_to_binary(8), content="1000")
  inspect(Convert::int_to_binary(15), content="1111")
  inspect(Convert::int_to_binary(0), content="0")
  inspect(Convert::int_to_binary(-8), content="-1000")
}

test "binary_to_int" {
  inspect(Convert::binary_to_int("1000"), content="Some(8)")
  inspect(Convert::binary_to_int("0b1111"), content="Some(15)")
  inspect(Convert::binary_to_int("0"), content="Some(0)")
  inspect(Convert::binary_to_int("-1000"), content="Some(-8)")
  inspect(Convert::binary_to_int("102"), content="None")
  inspect(Convert::binary_to_int(""), content="None")
}
